package uni.j2ee.forum.request;

import uni.j2ee.forum.helper.CommonHelper;
import uni.j2ee.forum.model.ForumData;
import uni.j2ee.forum.model.ForumPost;

public class RemovePostRequest {
	private ForumPost post;
	
	public String removePost() {
		if (post!=null) {
			if (ForumData.getInstance().removeEntity(post)) {
				CommonHelper.addMessage("post_removed", false);
			} else {
				CommonHelper.addMessage("post_remove_error", true);
			}
		}
		//stay on current page
		return null;
	}

	public void setPost(ForumPost post) {
		this.post = post;
	}

	public ForumPost getPost() {
		return post;
	}

}
